#ifndef VIEW
#define VIEW
#include <iostream>
#include <map>
#include <boost/any.hpp>

using namespace std;

class View{
	public:
		static map<string, boost::any> Data;
		static void getData(string, int&);
		static string getData(const string&);
		static map<string, boost::any> getArrData(const string&);
		static boost::any getAnyData(const string &);
	private:
 };
map<string, boost::any> View::Data;
void View::getData(string key, int &out){
	out= boost::any_cast<int>(View::Data[key]);
}
string View::getData(const string &key){
	string rt;
	if(View::Data.count(key) == 0)throw key+" is not declare";
	try{
		rt=boost::any_cast< string >(View::Data[key]);
	}
	catch(...){
		throw key+" is not an string";
	}
	return rt;
}

boost::any View::getAnyData(const string &key){
	if(View::Data.count(key) == 0)throw key+" is not declare";
	return View::Data[key];
}



map<string, boost::any> View::getArrData(const string &key){
	map<string, boost::any> rt;
	if(View::Data.count(key) == 0)throw key+" is not declare";
	try{
		rt=boost::any_cast< map<string, boost::any> >(View::Data[key]);
	}
	catch(...){
		throw key+" is not an array";
	}
	return rt;
}


#endif
